﻿@model HdipCricketClub.ViewModels.SelectPlayersViewModel

@{
    ViewBag.Title = "SelectPlayers";
}

<h2>SelectPlayers</h2>


@using (@Html.BeginForm("SelectPlayers", "SelectTeam", FormMethod.Post))
{
    @Html.ValidationSummary(true)
    <fieldset>
    <legend>Fixture:</legend>
    <br />
    @Html.DisplayFor(ModelItem => Model.SelectedFixture.Team.Club.ShortName) @Html.DisplayFor(ModelItem => Model.SelectedFixture.Team.name) vs 
    @Html.DisplayFor(ModelItem => Model.SelectedFixture.Opponent.club_name) @Html.DisplayFor(ModelItem => Model.SelectedFixture.Opponent.team_name)<br />
    on @Html.DisplayFor(ModelItem => Model.SelectedFixture.date)
    @Html.HiddenFor(ModelItem => Model.SelectedFixture.fixture_id)
    </fieldset>
    <fieldset>
    <legend>Available Players:</legend>
    <br />
    @{int i = 1;}
        @foreach (var item in Model.AvailablePlayers)
        {
            if (i == 1)
            {
                @Html.HiddenFor(modelItem => item.member_id)
                <span class="player-one-name">
                    @Html.DisplayFor(modelItem => item.FirstAndLastName)
                </span>
                <span class="player-one-select">
                    @Html.EditorFor(modelItem => item.Selected)
                </span>
            }
            if (i == 2)
            {
                @Html.HiddenFor(modelItem => item.member_id)
                <span class="player-two-name">
                    @Html.DisplayFor(modelItem => item.FirstAndLastName)
                </span>
                <span class="player-two-select">
                    @Html.EditorFor(modelItem => item.Selected)
                </span>
            }
            if (i == 3)
            {
                @Html.HiddenFor(modelItem => item.member_id)
                <span class="player-three-name">
                    @Html.DisplayFor(modelItem => item.FirstAndLastName)
                </span>
                <span class="player-three-select">
                    @Html.EditorFor(modelItem => item.Selected)
                </span>
            }
            if (i == 4)
            {
                @Html.HiddenFor(modelItem => item.member_id)
                <span class="player-four-name">
                    @Html.DisplayFor(modelItem => item.FirstAndLastName)
                </span>
                <span class="player-four-select">
                    @Html.EditorFor(modelItem => item.Selected)
                </span>
                <br /><br />
            }
            i++;
            if (i == 5)
            {
                i = 1;
            }
        }
    <br />        
    </fieldset>
    <p>
        <input type="submit" value="Select" />
        @Html.ActionLink("Return to Home Page", "Index", "Home")

    </p>
}

